// pages/search/search.js
const { gethotSearch } =require("../../api/index")
Page({

    /**
     * 页面的初始数据
     */
    data: {
        search:"",
        hotSearch:[],
        value:""
    },
    onLoad(options) {
         gethotSearch().then(res => {
             this.setData({
                 hotSearch:res.data.data.result
             })
         })
    },
    //内容改变
    onChange(e){
        this.setData({
            value:e.detail
        })
    },
    //实现搜索
    onSearch(){
        console.log("搜索",this.data.value);
        wx.navigateTo({
          url: '/pages/goods/goods?search=' + this.data.value,
        })
    },
    onSearchClick(){
        console.log("点击搜索按钮")
        wx.navigateTo({
            url: '/pages/goods/goods?search='+this.data.value,
          })
    },
    clickGetKey(e){
          console.log(e.currentTarget.dataset.hotkey);
          wx.navigateTo({
            url: '/pages/goods/goods?search='+this.data.value,
          })
    }
})